package com.kushe.dao;

import com.kushe.entity.Category;
import com.kushe.util.cache.UseCache;
import com.kushe.util.core.DataAccess;
import org.nutz.dao.Cnd;

import java.util.List;

/**
 * Created by WhiteBlue on 15/5/8.
 */
public class CategoryDao extends DataAccess {

    @UseCache(cacheName = "category")
    public Category get(int id) {
        return getDao().fetch(Category.class, id);
    }

    @UseCache(cacheName = "categoryList")
    public List<Category> listAll() {
        return getDao().query(Category.class, Cnd.orderBy().desc("name"));
    }

}
